<template>
    <div class="sun">
        <h3>sun(孙组件),{{name}}--{{price}}</h3>
    </div>
</template>

<script>
    import {inject,toRefs} from "vue"
    export default {
        name:"Sun",
        setup(){
            let car = inject("car");//后代组件通过inject接受来自祖先组件provide的值

            return{
                ...toRefs(car),
            }
        }
    }
</script>

<style>
    .sun{
        background-color: orange;
        padding: 10px;
    }
</style>